var member_id = store_id = ws = cart_id = cart_name = '';
var app = angular.module('flea',[]);
app.controller('fleaController',function($scope,$http){
	$scope.initView = function(){
		plus.nativeUI.showWaiting('加载中...');
		$http({
			method:"get",
			url:apiRoot + "?act=goods&op=goods_list_flea&gc_id="+cart_id+"&store_id="+store_id+"&m_id="+member_id,
		}).then(function SuccessCallback(data){
			plus.nativeUI.closeWaiting();
			console.log(JSON.stringify(data));
			$scope.flealist = data.data.datas;
			$scope.user_pic = user_pic;
			$scope.pics = pics;
		},function errorfunction(e){
			plus.nativeUI.closeWaiting();
			error();
		}) 
		
	}
	$scope.flea_details = function(goods_id,store_id){
		var nwaiting = plus.nativeUI.showWaiting();//显示原生等待框
		var webviewContent= plus.webview.create('./Flea_details.html','Flea_details.html',{},{goods_id:goods_id,store_id:store_id});//后台创建webview并打开show.html
		webviewContent.addEventListener("loaded", function() { //注册新webview的载入完成事件
	        nwaiting.close(); //新webview的载入完毕后关闭等待框
	        webviewContent.show("slide-in-right",500); //把新webview窗体显示出来，显示动画效果为速度200毫秒的右侧移入动画
	    }, false);
	}
})  
 
document.addEventListener('plusready',function(){
	aboutElement = document.querySelector('[ng-controller=fleaController]');
	$scope = angular.element(aboutElement).scope();
	member_id = plus.storage.getItem('id');
	store_id = plus.storage.getItem('store_id');
	ws = plus.webview.currentWebview();
	cart_id = ws.cart_id;
	cart_name = ws.cart_name;
	$('.release').on('click',function(){
		var nwaiting = plus.nativeUI.showWaiting();//显示原生等待框
		var webviewContent= plus.webview.create('./Flea_release.html','Flea_release.html',{},{cart_id:cart_id,cart_name:cart_name,spage:ws.id});//后台创建webview并打开show.html
		webviewContent.addEventListener("loaded", function() { //注册新webview的载入完成事件
	        nwaiting.close(); //新webview的载入完毕后关闭等待框
	        webviewContent.show("slide-in-right",20); //把新webview窗体显示出来，显示动画效果为速度200毫秒的右侧移入动画
	    }, false);
	})
	$scope.initView();
	$scope.$apply(); 
//	pullflea_fun();
},false);  


